package com.ruoyi.slope.device.sensor.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.slope.device.sensor.mapper.SlopeSensorListMapper;
import com.ruoyi.slope.device.sensor.domain.SlopeSensorList;
import com.ruoyi.slope.device.sensor.service.ISlopeSensorListService;

/**
 * 传感器列表Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-14
 */
@Service
public class SlopeSensorListServiceImpl implements ISlopeSensorListService 
{
    @Autowired
    private SlopeSensorListMapper slopeSensorListMapper;

    /**
     * 查询传感器列表
     * 
     * @param id 传感器列表主键
     * @return 传感器列表
     */
    @Override
    public SlopeSensorList selectSlopeSensorListById(Long id)
    {
        return slopeSensorListMapper.selectSlopeSensorListById(id);
    }

    /**
     * 查询传感器列表列表
     * 
     * @param slopeSensorList 传感器列表
     * @return 传感器列表
     */
    @DataScope(deptAlias = "s")
    @Override
    public List<SlopeSensorList> selectSlopeSensorListList(SlopeSensorList slopeSensorList)
    {
        return slopeSensorListMapper.selectSlopeSensorListList(slopeSensorList);
    }

    /**
     * 告警任务查询传感器列表列表
     *
     * @param slopeSensorList 传感器列表
     * @return 传感器列表
     */
    public List<SlopeSensorList> alarmSelectSlopeSensorListList(SlopeSensorList slopeSensorList)
    {
        return slopeSensorListMapper.selectSlopeSensorListList(slopeSensorList);
    }

    /**
     * 查询传感器ID列表
     *
     * @param slopeSensorList 传感器列表
     * @return 传感器ID列表
     */
    @DataScope(deptAlias = "s")
    @Override
    public Map<String,String> selectSlopeSensorId(SlopeSensorList slopeSensorList)
    {
        List<SlopeSensorList> list = slopeSensorListMapper.listSensorId(slopeSensorList);
        Map<String,String> map = new HashMap<String,String>();
        for (SlopeSensorList sensorList : list) {
            map.put(sensorList.getSensorCode(), sensorList.getSensorCode());
        }
        return map;
    }

    /**
     * 新增传感器列表
     * 
     * @param slopeSensorList 传感器列表
     * @return 结果
     */
    @Override
    public int insertSlopeSensorList(SlopeSensorList slopeSensorList)
    {
        return slopeSensorListMapper.insertSlopeSensorList(slopeSensorList);
    }

    /**
     * 修改传感器列表
     * 
     * @param slopeSensorList 传感器列表
     * @return 结果
     */
    @Override
    public int updateSlopeSensorList(SlopeSensorList slopeSensorList)
    {
        slopeSensorList.setUpdateTime(DateUtils.getNowDate());
        return slopeSensorListMapper.updateSlopeSensorList(slopeSensorList);
    }

    /**
     * 批量删除传感器列表
     * 
     * @param ids 需要删除的传感器列表主键
     * @return 结果
     */
    @Override
    public int deleteSlopeSensorListByIds(Long[] ids)
    {
        return slopeSensorListMapper.deleteSlopeSensorListByIds(ids);
    }

    /**
     * 删除传感器列表信息
     * 
     * @param id 传感器列表主键
     * @return 结果
     */
    @Override
    public int deleteSlopeSensorListById(Long id)
    {
        return slopeSensorListMapper.deleteSlopeSensorListById(id);
    }
}
